package com.tzu.ft.ui.utils;

import java.awt.Component;
import java.awt.Font;

import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 * UI工具
 */
public class FTUITools {

	public static String lookfeel_nimbus = javax.swing.plaf.nimbus.NimbusLookAndFeel.class.getName();
	public static String lookfeel_windows = com.sun.java.swing.plaf.windows.WindowsLookAndFeel.class.getName();
	public static String lookfeel_crossPlatform = UIManager.getCrossPlatformLookAndFeelClassName();
	public static String lookfeel_system = UIManager.getSystemLookAndFeelClassName();

	private static void test() throws Exception {
		UIManager.setLookAndFeel(lookfeel_nimbus);
	}

	/**
	 * 修改字体大小
	 */
	public static Font makeFont(Font ofont, int style, int size) {
		String name = ofont.getFontName();
		return new Font(name, style, size);
	}

	/**显示错误信息*/
	public static void showDialogError(Component component, String title, String message) {
		JOptionPane.showMessageDialog(component, message, title, JOptionPane.ERROR_MESSAGE);
	}
	
	/**显示警告信息*/
	public static void showDialogWaring(Component component, String title, String message) {
		JOptionPane.showMessageDialog(component, message, title, JOptionPane.WARNING_MESSAGE);
	}
	
	/**显示信息*/
	public static void showDialogInfo(Component component, String title, String message) {
		JOptionPane.showMessageDialog(component, message, title, JOptionPane.INFORMATION_MESSAGE);
	}
	
	/**显示问题消息*/
	public static void showDialogQuest(Component component, String title, String message) {
		JOptionPane.showMessageDialog(component, message, title, JOptionPane.QUESTION_MESSAGE);
	}

}
